import Vue from 'vue'
import Router from 'vue-router'
import commonRoutes from './modules/common'

const layout = () => import('@/views/layout')
const home = () => import('@/views/home')

Vue.use(Router)

const redirect = {
  path: '*',
  redirect: '/'
}

let router = new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      name: 'layout',
      component: layout,
      redirect: '/home',
      children: [
        {
          path: 'home',
          name: 'home',
          component: home,
          meta: {
            title: '首页',
            noLogin: true
          }
        }
      ]
    },
    ...commonRoutes,
    redirect
  ]
})

export default router
